import 'package:flutter/material.dart';

import '../utils/screenAdapter.dart';

appBar(String title, String rightTitle, VoidCallback rightButtonClick) {
  return AppBar(
    // 让title居左
    centerTitle: false,
    titleSpacing: 0,
    leading: const BackButton(),
    title: Text(
      title,
      style: TextStyle(fontSize: ScreenAdapter.fontSize(18)),
    ),
    actions: [
      InkWell(
        onTap: rightButtonClick,
        child: Container(
          padding: EdgeInsets.only(
              left: ScreenAdapter.width(15), right: ScreenAdapter.width(15)),
          alignment: Alignment.center,
          child: Text(
            rightTitle,
            style: TextStyle(
              fontSize: ScreenAdapter.fontSize(18),
              color: Colors.grey[500],
            ),
            textAlign: TextAlign.center,
          ),
        ),
      )
    ],
  );
}
